﻿using System.Collections.Generic;
using System.Windows.Controls;
using System.Collections;
using Kiva7.Controls;
using Kiva7.ViewModels;
using Kiva7.DataClasses;

namespace Kiva7.Pages
{
    public partial class TeamsControl : BaseUserControl
    {
        public TeamsControl()
        {
            InitializeComponent();
        }

        public void SetBindingList(IEnumerable itemsSource)
        {
            lbxTeams.ItemsSource = itemsSource;
        }

        private void LbxTeamsSelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            Team model = lbxTeams.SelectedItem as Team;
            if (model != null)
            {
                DoNavigate(TeamDetailPage.GetPageUrl(lbxTeams.ItemsSource as List<Team>, lbxTeams.SelectedIndex));
                lbxTeams.SelectedItem = null;
            }
        }

    }
}
